package com.probiz.estore.common.model.content;

import com.probiz.estore.catalog.service.ProductCategoryManager;
import com.probiz.estore.common.model.catalog.ProductCategory;
import com.probiz.estore.common.model.content.base.ProductAdvertisementTbl;
import com.probiz.estore.core.util.ContextUtil;

public class ProductAdvertisement extends ProductAdvertisementTbl {

	public ProductAdvertisement () {
		super();
	}
	
	/**
	 * Default Key Fields Constructor for class ProductAdvertisement
	 */
	public ProductAdvertisement (
		 Integer in_productAdvertisementId
		) {
		super (
		  in_productAdvertisementId
		);
	}
	/**
	 * 使用此方法目的在于以后可能扩展，广告在其他类型的目录内，例如内容目录、专场目录
	 * @return
	 */
	public ProductCategory getProductCategory(){
		if(this.categoryId != null){
			ProductCategoryManager productCategoryManager = (ProductCategoryManager)ContextUtil.getInstance().getSpringBeanById("productCategoryManager");
			return productCategoryManager.getById(this.categoryId);
		}else{
			return null;
		}
	}
	
}
